package Datenbankhandler;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class DBConn {

	private static Connection conn;
	
	private static  void getForName(){
		try{
		Class.forName("oracle.jdbc.driver.OracleDriver");
	}
	catch (ClassNotFoundException e){
	System.out.println("Datenbanktreiber nicht gefunden");
		e.printStackTrace();
}
	}
	
	public static Connection getConnection(){
		getForName();
		try{
			conn=DriverManager.getConnection("jdbc:oracle:thin:a0925981/thekingmani@oracle-lab.cs.univie.ac.at:1521:lab");
		}
		catch(SQLException e){
			System.out.println("Keine Datenbankconnection");
			e.printStackTrace();
		}
	
	return conn;
	}
	
	public static void closeConnection(){
		try{
			if(conn != null)
				conn.close();
		} catch(SQLException e){
			e.printStackTrace();
		}
	}
	
	
	}
	
